package com.linkdood.app.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkdood.app.domain.Organization;
import com.linkdood.app.dto.OrganizationDTO;
import java.util.List;
import java.util.Optional;

/**
 * dood organization
 *
 * @author YunJ
 */

public interface OrganizationService extends IService<Organization> {

    Optional<Organization> getOrganization(Long id);

    Organization getByOrgId(String thirdPartyId, Long orgId);

    IPage<Organization> pageOrganizationsByOrgId(String thirdPartyId, String orgId, Page<Organization> page);

    long countOrganization();

    Integer countOrganization(String thirdPartyId);

    /**
     * 获取根组织
     */
    List<OrganizationDTO> listRootOrganizations(String thirdPartyId);

    /**
     * 获取子组织
     */
    List<OrganizationDTO> listSonOrganizations(String thirdPartyId, String orgId);

    /**
     * 获取组织架构树
     */
    List<OrganizationDTO> listOrganizationTrees(String thirdPartyId);


    Optional<Organization> getByOrgId(String orgId);

    /**
     * 查询用户的所有部门
     *
     * @param userId 用户id
     */
    List<Organization> listByUserId(String userId);

    Optional<Organization> getByOrgIdAndThirdPartyId(String orgId, String thirdPartyId);

    List<Organization> listByOrgCodeAndThirdPartyId(String code, String thirdPartyId);

}
